package com.ysl.study.designpattern.structure.decoration;

import java.math.BigDecimal;

/**
 * 装饰器模式
 * ConcreteDecorator（具体装饰角色）
 * 对某个具体构件的功能进行增强
 * @author yangshanlin
 * @date 2023/2/23 18:19
 * @describe
 */
public class XiangLongShiBaZhang extends Decorator{

    private BigDecimal power;

    public XiangLongShiBaZhang(GongFu gongfu, BigDecimal power){
        super(gongfu);
        this.power = power;
    }

    @Override
    public BigDecimal attack() {
        // 具体构件原本的行为
        BigDecimal attack = super.attack();

        // 具体装饰类增强了具体构件的行为
        attack = attack.add(power);

        System.out.println("学习降龙十八掌，战斗力+:" + power);
        return attack;
    }
}
